package com.it.sun.learning001.config;

import com.it.sun.learning001.lifecycle.DisposableBeanImpl;
import com.it.sun.learning001.lifecycle.InitializingBeanImpl;
import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;

import java.util.Arrays;
import java.util.List;

/**
 * @ClassName com.it.sun.learning001.config.CommonConfiguration
 * @Author sunmannian
 * @Date 2021/1/25 16:53
 * @Version V1.0
 * Description  <请输入一句话描述该类功能>
 * Copyright (C) 北京中电兴发科技有限公司  since 2021/1/25
 */
@Configuration
public class CommonConfiguration {

	//	@Bean
	public List<String> ignoreUrls() {
		return Arrays.asList("/home.html", "/list.*", "/user/*", "/**");
	}

	//	@Bean(initMethod = "initMethod")
	public InitializingBeanImpl initializingBeanBean() {
		return new InitializingBeanImpl();
	}

	@Bean(destroyMethod = "destroyMethod")
//	@Scope(value = "prototype")
	public DisposableBeanImpl disposableBeanBean() {
		return new DisposableBeanImpl();
	}



}

class LogInterceptor implements MethodInterceptor {

	@Override
	public Object invoke(MethodInvocation invocation) throws Throwable {
		System.err.println("start logging");
		return invocation.proceed();
	}
}

